package com.didispace.chapter36.vo;

import cn.hutool.core.date.DateUtil;
import com.didispace.chapter36.entity.User;
import io.github.linpeilie.annotations.AutoMapper;
import io.github.linpeilie.annotations.AutoMapping;
import lombok.Data;

import java.time.LocalDateTime;

/**
 * @author mrzhaowy
 */
@Data
@AutoMapper(target = User.class)
public class UserVO {
    @AutoMapping(target = "id")
    private Long userId;
    @AutoMapping(target = "name")
    private String userName;
    @AutoMapping(target = "age")
    private Integer userAge;
    @AutoMapping(target = "sex")
    private String userSex;
    private String userEmail;
    @AutoMapping(target = "birth", expression = "java(cn.hutool.core.date.DateUtil.parseDateTime(source.getBirth()))")
    private String birth;
    @AutoMapping(target = "createdAt")
    private LocalDateTime userCreatedAt;
}
